package com.zs.grain.ui

import android.app.Application
import androidx.lifecycle.MutableLiveData
import javax.inject.Inject
import com.zs.grain.service.*
import com.xnkj1688.semplibrary.mvvm.BaseViewModel


class DurationViewModel @Inject constructor(
    val mApp: Application,
    val mDataService: DataService
) : BaseViewModel(mApp) {

    val remark = MutableLiveData<String>()
    val value = MutableLiveData<Int>()
    val min = MutableLiveData<Int>()
    val max = MutableLiveData<Int>()
    var isDurationTesting = false
    fun init(remark: String, min: Int, max: Int, value: Int) {
        this.remark.value = remark
        this.min.value = min
        this.max.value = max
        this.value.value = value
    }

    fun onClickConfirm() {
        if(isDurationTesting==false){
            isDurationTesting = true
            uiNotify.value = this.getNotify("Confirm")
        }
    }

    fun onClickCancel() {
        isDurationTesting = false
        uiNotify.value = this.getNotify("Cancel")
    }

    fun onClickStop() {
        if(isDurationTesting){
            isDurationTesting = false
            uiNotify.value = this.getNotify("Stop")
        }
    }
}